import { Component, OnInit,Input,TemplateRef,ChangeDetectionStrategy,ContentChild } from '@angular/core';
import { SafeStyle, DomSanitizer } from '@angular/platform-browser';

@Component({
  selector: 'el-card',
  changeDetection: ChangeDetectionStrategy.OnPush,
  templateUrl: './card.component.html'
})
export class CardComponent implements OnInit {
  private sanitizer:any;
  @ContentChild('header') header!: TemplateRef<any>;
  @Input('header') headerStr: string = '';
  //设置阴影显示时机 always / hover / never
  @Input() shadow: string = 'always';
  @Input('body-style') bodyStyle: string = " padding: 20px ";

  constructor(sanitizer: DomSanitizer){
    this.sanitizer = sanitizer;
  };

  ngOnInit(): void {
  }


  makeSafebodyStyle(){
    return this.sanitizer.bypassSecurityTrustStyle(this.bodyStyle);
  }
}
